
#pragma once

#include "vec.h"
#include "matrix.h"

namespace Blox
{
	class OBB
	{
	public:
		OBB ( )
		{
			mTransform.Identity();
			vExtents.One();
			vExtents*=0.5f;
		}
		OBB ( Matrix const & rTransform, Vec const & rExtents ) : mTransform(rTransform), vExtents(rExtents) { }
		OBB ( Vec const & rCentre, Vec const & rExtents ) : vExtents(rExtents)
		{
			mTransform.Identity();
			mTransform.SetTranslation( rCentre );
		}

		//void Set ( Bounds const & rBounds );
		//inline float LongestSide ( ) const { return FMax( FMax( vExtents.x*2.0f, vExtents.y*2.0f ), vExtents.z*2.0f ); }

		inline void SetTransform ( Matrix const & val ) { mTransform = val; }
		inline void SetTranslation ( Vec const & val ) { mTransform.SetTranslation(val); }
		inline void SetExtents ( Vec const & val ) { vExtents = val; }

		inline Matrix const & GetTransform ( ) { return mTransform; }
		inline Vec const & GetTranslation ( ) { return mTransform.GetTranslation(); }
		inline Vec const & GetExtents ( ) { return vExtents; }

		void GetBounds ( Bounds & rBounds );

		Matrix mTransform;
		Vec vExtents;
	};

}

